/**
 * Created by Administrator on 15-10-20.
 */
var Core = require("./core.js");
var core = new Core();
var CheckNormal = RichBase.extend({
	init : function(){
		this.checkInp = $("#termSearInp");
		this.listUl = $("#myOrderList");
	},
	check : function(){
		var listUl = this.listUl;
		var salerid = core.getSalerid();
		var voucher = this.checkInp.val();
		var cmode = 2;
		core.query(cmode,salerid,voucher,{
			loading : function(){ listUl.html(core.getQueryLoadingHtml("正在验证，请稍后..."))},
			removeLoading : function(){ listUl.html("")},
			timeout : function(res){ alert("请求超时，请稍后重试.") },
			serverError : function(res){ alert("请求也错，请稍后重试.")},
			unlogin : function(res){
				alert("登录状态已过期，请重新登录");
				window.location.href = "http://www.12301.cc/dlogin_n.html";
			},
			fail : function(res){
				var msg = res.msg || "请求出错，请稍后重试";
				alert(msg);
			},
			empty : function(res){
				listUl.html('<li class="sta empty" style="height:150px;line-height:150px; text-align:left">查无订单...</li>')
			},
			success : function(res){
				var html = "";
				html = core.buildHtml(res);
				html && listUl.html(html);
			}
		})
	}
});
module.exports = CheckNormal;